package com.flurry.sdk;

import java.io.File;

public class kf<T> {
    private static final String a = kf.class.getSimpleName();
    private final File b;
    private final lg<T> c;

    public kf(File file, String str, int i, lj<T> ljVar) {
        this.b = file;
        this.c = new le(new li(str, i, ljVar));
    }

    /* JADX WARNING: Removed duplicated region for block: B:13:0x003e  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final T a() {
        /*
            r8 = this;
            r7 = 3
            r0 = 0
            java.io.File r1 = r8.b
            if (r1 != 0) goto L_0x0007
        L_0x0006:
            return r0
        L_0x0007:
            java.io.File r1 = r8.b
            boolean r1 = r1.exists()
            if (r1 != 0) goto L_0x002b
            r1 = 5
            java.lang.String r2 = a
            java.lang.StringBuilder r3 = new java.lang.StringBuilder
            java.lang.String r4 = "No data to read for file:"
            r3.<init>(r4)
            java.io.File r4 = r8.b
            java.lang.String r4 = r4.getName()
            java.lang.StringBuilder r3 = r3.append(r4)
            java.lang.String r3 = r3.toString()
            com.flurry.sdk.km.a((int) r1, (java.lang.String) r2, (java.lang.String) r3)
            goto L_0x0006
        L_0x002b:
            r1 = 0
            java.io.FileInputStream r2 = new java.io.FileInputStream     // Catch:{ Exception -> 0x005e, all -> 0x0080 }
            java.io.File r3 = r8.b     // Catch:{ Exception -> 0x005e, all -> 0x0080 }
            r2.<init>(r3)     // Catch:{ Exception -> 0x005e, all -> 0x0080 }
            com.flurry.sdk.lg<T> r3 = r8.c     // Catch:{ Exception -> 0x0089 }
            java.lang.Object r0 = r3.a(r2)     // Catch:{ Exception -> 0x0089 }
            com.flurry.sdk.ly.a((java.io.Closeable) r2)
        L_0x003c:
            if (r1 == 0) goto L_0x0006
            java.lang.String r1 = a
            java.lang.StringBuilder r2 = new java.lang.StringBuilder
            java.lang.String r3 = "Deleting data file:"
            r2.<init>(r3)
            java.io.File r3 = r8.b
            java.lang.String r3 = r3.getName()
            java.lang.StringBuilder r2 = r2.append(r3)
            java.lang.String r2 = r2.toString()
            com.flurry.sdk.km.a((int) r7, (java.lang.String) r1, (java.lang.String) r2)
            java.io.File r1 = r8.b
            r1.delete()
            goto L_0x0006
        L_0x005e:
            r1 = move-exception
            r2 = r0
        L_0x0060:
            r3 = 3
            java.lang.String r4 = a     // Catch:{ all -> 0x0087 }
            java.lang.StringBuilder r5 = new java.lang.StringBuilder     // Catch:{ all -> 0x0087 }
            java.lang.String r6 = "Error reading data file:"
            r5.<init>(r6)     // Catch:{ all -> 0x0087 }
            java.io.File r6 = r8.b     // Catch:{ all -> 0x0087 }
            java.lang.String r6 = r6.getName()     // Catch:{ all -> 0x0087 }
            java.lang.StringBuilder r5 = r5.append(r6)     // Catch:{ all -> 0x0087 }
            java.lang.String r5 = r5.toString()     // Catch:{ all -> 0x0087 }
            com.flurry.sdk.km.a(r3, r4, r5, r1)     // Catch:{ all -> 0x0087 }
            r1 = 1
            com.flurry.sdk.ly.a((java.io.Closeable) r2)
            goto L_0x003c
        L_0x0080:
            r1 = move-exception
            r2 = r0
            r0 = r1
        L_0x0083:
            com.flurry.sdk.ly.a((java.io.Closeable) r2)
            throw r0
        L_0x0087:
            r0 = move-exception
            goto L_0x0083
        L_0x0089:
            r1 = move-exception
            goto L_0x0060
        */
        throw new UnsupportedOperationException("Method not decompiled: com.flurry.sdk.kf.a():java.lang.Object");
    }

    /* JADX WARNING: Removed duplicated region for block: B:28:? A[RETURN, SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:4:0x0023  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void a(T r9) {
        /*
            r8 = this;
            r3 = 1
            r7 = 3
            r0 = 0
            r1 = 0
            if (r9 != 0) goto L_0x0043
            java.lang.String r0 = a
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r2 = "No data to write for file:"
            r1.<init>(r2)
            java.io.File r2 = r8.b
            java.lang.String r2 = r2.getName()
            java.lang.StringBuilder r1 = r1.append(r2)
            java.lang.String r1 = r1.toString()
            com.flurry.sdk.km.a((int) r7, (java.lang.String) r0, (java.lang.String) r1)
            r0 = r3
        L_0x0021:
            if (r0 == 0) goto L_0x0042
            java.lang.String r0 = a
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            java.lang.String r2 = "Deleting data file:"
            r1.<init>(r2)
            java.io.File r2 = r8.b
            java.lang.String r2 = r2.getName()
            java.lang.StringBuilder r1 = r1.append(r2)
            java.lang.String r1 = r1.toString()
            com.flurry.sdk.km.a((int) r7, (java.lang.String) r0, (java.lang.String) r1)
            java.io.File r0 = r8.b
            r0.delete()
        L_0x0042:
            return
        L_0x0043:
            java.io.File r2 = r8.b     // Catch:{ Exception -> 0x0053 }
            boolean r2 = com.flurry.sdk.lx.a(r2)     // Catch:{ Exception -> 0x0053 }
            if (r2 != 0) goto L_0x0074
            java.io.IOException r0 = new java.io.IOException     // Catch:{ Exception -> 0x0053 }
            java.lang.String r2 = "Cannot create parent directory!"
            r0.<init>(r2)     // Catch:{ Exception -> 0x0053 }
            throw r0     // Catch:{ Exception -> 0x0053 }
        L_0x0053:
            r0 = move-exception
        L_0x0054:
            r2 = 3
            java.lang.String r4 = a     // Catch:{ all -> 0x0084 }
            java.lang.StringBuilder r5 = new java.lang.StringBuilder     // Catch:{ all -> 0x0084 }
            java.lang.String r6 = "Error writing data file:"
            r5.<init>(r6)     // Catch:{ all -> 0x0084 }
            java.io.File r6 = r8.b     // Catch:{ all -> 0x0084 }
            java.lang.String r6 = r6.getName()     // Catch:{ all -> 0x0084 }
            java.lang.StringBuilder r5 = r5.append(r6)     // Catch:{ all -> 0x0084 }
            java.lang.String r5 = r5.toString()     // Catch:{ all -> 0x0084 }
            com.flurry.sdk.km.a(r2, r4, r5, r0)     // Catch:{ all -> 0x0084 }
            com.flurry.sdk.ly.a((java.io.Closeable) r1)
            r0 = r3
            goto L_0x0021
        L_0x0074:
            java.io.FileOutputStream r2 = new java.io.FileOutputStream     // Catch:{ Exception -> 0x0053 }
            java.io.File r4 = r8.b     // Catch:{ Exception -> 0x0053 }
            r2.<init>(r4)     // Catch:{ Exception -> 0x0053 }
            com.flurry.sdk.lg<T> r1 = r8.c     // Catch:{ Exception -> 0x008c, all -> 0x0089 }
            r1.a(r2, r9)     // Catch:{ Exception -> 0x008c, all -> 0x0089 }
            com.flurry.sdk.ly.a((java.io.Closeable) r2)
            goto L_0x0021
        L_0x0084:
            r0 = move-exception
        L_0x0085:
            com.flurry.sdk.ly.a((java.io.Closeable) r1)
            throw r0
        L_0x0089:
            r0 = move-exception
            r1 = r2
            goto L_0x0085
        L_0x008c:
            r0 = move-exception
            r1 = r2
            goto L_0x0054
        */
        throw new UnsupportedOperationException("Method not decompiled: com.flurry.sdk.kf.a(java.lang.Object):void");
    }

    public final boolean b() {
        if (this.b == null) {
            return false;
        }
        return this.b.delete();
    }
}
